<template>
  <div class="app-container">
    <el-form :inline="true" :model="listQuery" class="demo-form-inline" @submit.native.prevent>
      <el-form-item label="用户名">
        <el-input v-model="listQuery.q_memberName" style="width: 200px;" size="small" class="filter-item" />
      </el-form-item>
      <el-form-item label="支付号">
        <el-input v-model="listQuery.q_paySn" style="width: 200px;" size="small" class="filter-item" />
      </el-form-item>
      <el-form-item label="支付金额">
        <el-input v-model="listQuery.q_payMoney" style="width: 200px;" size="small" class="filter-item" />
      </el-form-item>
      <el-form-item>
        <el-button class="filter-item" size="small" type="primary" @click="check">查询</el-button>
        <el-button class="filter-item" size="small" type="primary" @click="rest">重置</el-button>
      </el-form-item>
    </el-form>
    <el-table
      ref="singleTable"
      :data="dataList"
      v-loading="listLoading"
      border
      fit
      highlight-current-row
      @current-change="handleCurrentChange"
      style="width: 100%">
      <el-table-column
        type="index"
        align="center"
        width="50">
      </el-table-column>
      <el-table-column
        property="memberName"
        label="用户名"
        width="150">
      </el-table-column>
      <el-table-column
        property="paymentName"
        width="200"
        label="支付方式名称">
      </el-table-column>
      <el-table-column
        property="payMoney"
        width="150"
        label="支付金额">
      </el-table-column>
      <el-table-column
        property="paySn"
        width="200"
        label="支付订单号">
      </el-table-column>
      <el-table-column
        property="tradeSn"
        width="200"
        label="支付交易流水号">
      </el-table-column>
      <el-table-column
        property="payState"
        width="100"
        label="是否支付">
        <template slot-scope="scope">
          {{ codeBox.BALANCE_PAYSTATE[scope.row.payState] }}
        </template>
      </el-table-column>
      <el-table-column
        property="createTime"
        width="150"
        label="创建时间">
      </el-table-column>
      <el-table-column
        property="payFinishTime"
        width="150"
        label="支付完成时间">
      </el-table-column>
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
  </div>
</template>

<script>
import { memberBalancePayLogList } from '@/api/member'
import Pagination from '@/components/Pagination'
import { Message } from 'element-ui'
import { getCodeManager } from '@/api/all'
export default {
  name: 'memberbalancepayloglist',
  components: { Pagination },
  data() {
    return {
      dataList: [],
      drawingState: [],
      total: 0,
      listLoading: false,
      listQuery: {
        page: 1,
        limit: 20,
        q_memberName: '',
        q_paySn: '',
        q_payMoney: ''
      }
    }
  },
  created() {
    getCodeManager('BALANCE_PAYSTATE', () => {
    })
    this.getList()
  },
  methods:{
    handleCurrentChange(val) {
      // 选中当前行数据
      this.currentRow = val
    },
    // 获取列表数据
    getList() {
      this.listLoading = true
      memberBalancePayLogList(this.listQuery).then(response => {
        this.dataList = response.data.rows
        this.total = response.data.total
        this.listLoading = false
      })
    },
    check() {
      this.getList()
    },
    rest() {
      this.listQuery = {
        page: 1,
        limit: 20,
        q_memberName: '',
        q_paySn: '',
        q_payMoney: ''
      }
      this.getList()
    }
  }
}
</script>

<style>
  .filter-container .el-col-6 {
    margin-bottom: 15px;
  }
  .filter-item {
    margin-bottom: 0
  }
  /deep/ .filter-container label {
    font-size: 14px;
    font-weight: 500;
    margin-right: 10px;
  }
</style>
